#!/bin/bash
GHPROXY=https://ghfast.top/

echo -n >version.txt 
# fzf 
fzf_version=0.62.0
echo "fzf.tar.gz ${fzf_version}" >>version.txt
curl -SL -o  neovim-tools-macos-x86_64/fzf.tar.gz ${GHPROXY}https://github.com/junegunn/fzf/releases/download/v${fzf_version}/fzf-${fzf_version}-darwin_amd64.tar.gz
curl -SL -o   neovim-tools-macos-arm64/fzf.tar.gz ${GHPROXY}https://github.com/junegunn/fzf/releases/download/v${fzf_version}/fzf-${fzf_version}-darwin_arm64.tar.gz
curl -SL -o  neovim-tools-linux-x86_64/fzf.tar.gz ${GHPROXY}https://github.com/junegunn/fzf/releases/download/v${fzf_version}/fzf-${fzf_version}-linux_amd64.tar.gz
curl -SL -o neovim-tools-linux-aarch64/fzf.tar.gz ${GHPROXY}https://github.com/junegunn/fzf/releases/download/v${fzf_version}/fzf-${fzf_version}-linux_arm64.tar.gz

# rg(ripgrep)
ripgrep_version=14.1.1
curl -SL -o  neovim-tools-macos-x86_64/ripgrep.tar.gz ${GHPROXY}https://github.com/BurntSushi/ripgrep/releases/download/${ripgrep_version}/ripgrep-${ripgrep_version}-x86_64-apple-darwin.tar.gz
curl -SL -o   neovim-tools-macos-arm64/ripgrep.tar.gz ${GHPROXY}https://github.com/BurntSushi/ripgrep/releases/download/${ripgrep_version}/ripgrep-${ripgrep_version}-aarch64-apple-darwin.tar.gz
curl -SL -o  neovim-tools-linux-x86_64/ripgrep.tar.gz ${GHPROXY}https://github.com/BurntSushi/ripgrep/releases/download/${ripgrep_version}/ripgrep-${ripgrep_version}-x86_64-unknown-linux-musl.tar.gz
curl -SL -o neovim-tools-linux-aarch64/ripgrep.tar.gz ${GHPROXY}https://github.com/BurntSushi/ripgrep/releases/download/${ripgrep_version}/ripgrep-${ripgrep_version}-aarch64-unknown-linux-gnu.tar.gz

# fd
fd_version=10.2.0
echo "fd.tar.gz ${fd_version}" >>version.txt
curl -SL -o  neovim-tools-macos-x86_64/fd.tar.gz ${GHPROXY}https://github.com/sharkdp/fd/releases/download/v${fd_version}/fd-v${fd_version}-x86_64-apple-darwin.tar.gz
curl -SL -o   neovim-tools-macos-arm64/fd.tar.gz ${GHPROXY}https://github.com/sharkdp/fd/releases/download/v${fd_version}/fd-v${fd_version}-aarch64-apple-darwin.tar.gz
curl -SL -o  neovim-tools-linux-x86_64/fd.tar.gz ${GHPROXY}https://github.com/sharkdp/fd/releases/download/v${fd_version}/fd-v${fd_version}-x86_64-unknown-linux-gnu.tar.gz
curl -SL -o neovim-tools-linux-aarch64/fd.tar.gz ${GHPROXY}https://github.com/sharkdp/fd/releases/download/v${fd_version}/fd-v${fd_version}-aarch64-unknown-linux-musl.tar.gz

# lazygit
lazygit_version=0.50.0
echo "lazygit.tar.gz ${lazygit_version}" >>version.txt
curl -SL -o  neovim-tools-macos-x86_64/lazygit.tar.gz ${GHPROXY}https://github.com/jesseduffield/lazygit/releases/download/v${lazygit_version}/lazygit_${lazygit_version}_Darwin_x86_64.tar.gz
curl -SL -o   neovim-tools-macos-arm64/lazygit.tar.gz ${GHPROXY}https://github.com/jesseduffield/lazygit/releases/download/v${lazygit_version}/lazygit_${lazygit_version}_Darwin_arm64.tar.gz
curl -SL -o  neovim-tools-linux-x86_64/lazygit.tar.gz ${GHPROXY}https://github.com/jesseduffield/lazygit/releases/download/v${lazygit_version}/lazygit_${lazygit_version}_Linux_x86_64.tar.gz
curl -SL -o neovim-tools-linux-aarch64/lazygit.tar.gz ${GHPROXY}https://github.com/jesseduffield/lazygit/releases/download/v${lazygit_version}/lazygit_${lazygit_version}_Linux_arm64.tar.gz


# neovim
neovim_version=stable
echo "neovim.tar.gz stable_$(date +%F)" >>version.txt
#curl -fL -o neovim-tools-linux-x86_64/neovim.tar.gz ${GHPROXY}https://github.com/neovim/neovim-releases/releases/download/stable/nvim-linux-x86_64.tar.gz
curl -SL -o  neovim-tools-macos-x86_64/neovim.tar.gz ${GHPROXY}https://github.com/neovim/neovim-releases/releases/download/stable/nvim-macos-x86_64.tar.gz
curl -SL -o   neovim-tools-macos-arm64/neovim.tar.gz ${GHPROXY}https://github.com/neovim/neovim-releases/releases/download/stable/nvim-macos-arm64.tar.gz
curl -SL -o  neovim-tools-linux-x86_64/neovim.tar.gz ${GHPROXY}https://github.com/neovim/neovim-releases/releases/download/stable/nvim-linux-x86_64.tar.gz
curl -SL -o neovim-tools-linux-aarch64/neovim.tar.gz ${GHPROXY}https://github.com/neovim/neovim/releases/download/stable/nvim-linux-arm64.tar.gz


# tmux
tmux_version=3.5a
echo "tmux.tar.gz ${tmux_version}" >>version.txt
curl -fLo neovim-tools-src/tmux.tar.gz ${GHPROXY}https://github.com/tmux/tmux/releases/download/${tmux_version}/tmux-${tmux_version}.tar.gz

# copy version files
\cp -f version.txt neovim-tools-linux-aarch64
\cp -f version.txt neovim-tools-linux-x86_64
\cp -f version.txt neovim-tools-macos-arm64
\cp -f version.txt neovim-tools-macos-x86_64
\cp -f version.txt neovim-tools-src

echo "Done!!!"
